@extends('admin.layout')
@section('content')
<div class="admin-biaogelist">
    <div class="listbiaoti am-cf">
      <ul class="am-icon-flag on">申请列表</ul>
      <dl class="am-icon-home" style="float: right;"> 当前位置： 首页 > <a href="javascript:void(0);">申请列表</a></dl>
    </div>
	<div class="am-btn-toolbars am-btn-toolbar am-kg am-cf">
    <form action="/dashboard/list_apply" method="get" id="search_form">
        <ul class="tabBarBtn">
            <li style="float:right;margin-right:10px"><input type="button" id="to_be_open" class="am-btn am-radius am-btn-xs {{isset($_GET['status_open']) && $_GET['status_open'] == '0' ? 'am-btn-success' : 'am-btn-danger'}}" style="margin-top: -1px;" value="待开启" /></li>
            <li style="float:right;"><input type="button" id="opened" class="am-btn am-radius am-btn-xs  {{isset($_GET['status_open']) && $_GET['status_open'] == '1' ? 'am-btn-success' : 'am-btn-danger'}}" style="margin-top: -1px;" value="已开启" /></li>
            <li style="float:right;"><input type="button" id="unexpire" class="am-btn am-radius am-btn-xs {{isset($_GET['status_type']) && $_GET['status_type'] == '1' ? 'am-btn-success' : 'am-btn-danger'}}" style="margin-top: -1px;" value="未过期" /></li>
            <li style="float:right;"><input type="button" id="expire" class="am-btn am-radius am-btn-xs {{isset($_GET['status_type']) && $_GET['status_type'] == '2' ? 'am-btn-success' : 'am-btn-danger'}}" style="margin-top: -1px;" value="已过期" /></li>
            <li><input type="text" class="am-form-field am-input-sm am-input-xm" name="name" value="{{$_GET['name'] or ''}}" placeholder="用户名" /></li>
            <li><input type="text" class="am-form-field am-input-sm am-input-xm" name="phone" value="{{$_GET['phone'] or ''}}" placeholder="手机号" /></li>
            <li><input type="submit" class="am-btn am-radius am-btn-xs am-btn-success" style="margin-top: -1px;" value="搜索" /></li>
            {{--<li>账户状态
                <select id="ifopen" name="status_open">
                    <option value="">请选择</option>
                    <option value="0" {{isset($_GET['status_open']) && $_GET['status_open'] == '0' ? 'selected' : ''}}>未开启</option>
                    <option value="1" {{isset($_GET['status_open']) && $_GET['status_open'] == '1' ? 'selected' : ''}}>已开启</option>
                </select>
            </li>
            <li>申请状态
                <select id="ifexpire" name="status_type">
                    <option value="">请选择</option>
                    <option value="0" {{isset($_GET['status_type']) && $_GET['status_type'] == '0' ? 'selected' : ''}}>未过期</option>
                    <option value="1" {{isset($_GET['status_type']) && $_GET['status_type'] == '1' ? 'selected' : ''}}>已过期</option>
                </select>
            </li>--}}
            <input type="hidden" name="status_open" id="status_open" value="{{$_GET['status_open'] or ''}}"/>
            <input type="hidden" name="status_type" id="status_type" value="{{$_GET['status_type'] or ''}}"/>
        </ul>
    </form>
</div>

    <div class="am-form am-g">
          <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped">
            <thead>
              <tr class="am-success">
                <th class="table-id">ID</th>
                <th class="table-title">user_id</th>
                <th class="table-title">用户名</th>
                <th class="table-title">手机号</th>
                {{--<th class="table-title">职务</th>--}}
                <th class="table-type">存储空间(MB)</th>
                <th class="table-date am-hide-sm-only">已用空间(MB)</th>
                <th class="table-title">账户状态</th>
                <th class="table-title">同步状态</th>
                <th class="table-title">申请状态</th>
                <th width="163px" class="table-set">操作</th>
              </tr>
            </thead>
            <tbody>
            @foreach ($applies as $apply)
                <tr>
                    <td>{{($loop->index)+1}}</td>
                    <td>{{$apply->qyh_userid}}</td>
                    <td>{{$apply->nickname}}</td>
                    <td>{{$apply->phone or ''}}</td>
{{--                    <td>{{$apply->role == '0' ? "学生" : ($apply->role == '1' ? "教师" : "其他")}}</td>--}}
                    <td>{{round($apply->total_storage/1024, 1)}}</td>
                    <td class="am-hide-sm-only">{{round($apply->used_storage/1024, 1)}}</td>
                    <td>{{$apply->status == '1' ? "已开启" : "未开启"}}</td>
                    <td>{{$apply->synced_with_qyh == '1' ? "已同步" : "未同步"}}</td>
                    <td>{{$apply->status_apply}}</td>
                    <td><div class="am-btn-toolbar">
                            <div class="am-btn-group am-btn-group-xs">
                                {{--@if(isset($_GET['status_type']) && $_GET['status_type'] == '1')--}}
                                    {{--<button class="am-btn am-btn-default am-btn-xs am-text-secondary am-round enable_apply" data-id="{{$apply->id}}" data-total_storage="{{$apply->total_storage}}">启用</button>--}}
                                {{--@elseif(isset($_GET['status_type']) && $_GET['status_type'] == '2')--}}
                                    {{--@if($apply->status == '1')--}}
                                        {{--<button class="am-btn am-btn-default am-btn-xs am-text-danger am-round disable_apply" data-id="{{$apply->id}}">停用</button>--}}
                                    {{--@else--}}
                                        {{--<button class="am-btn am-btn-default am-btn-xs am-text-danger am-round del_apply" data-id="{{$apply->id}}">删除</button>--}}
                                    {{--@endif--}}
                                {{--@else--}}
                                    <button class="am-btn am-btn-default am-btn-xs am-text-secondary am-round modify_apply" data-id="{{$apply->user_id}}">编辑{{--<span class="am-icon-pencil-square-o"></span>--}}</button>
                                {{--@endif--}}
                            </div>
                        </div></td>
                </tr>
            @endforeach
            </tbody>
          </table>
{{--        {{isset($_GET['name']) ? $applies->appends(['name' => $_GET['name']])->links() : $applies->links()}}--}}
        {!! $applies->render() !!}
          <hr />
          {{--<p>注：.....</p>--}}
        </div>
</div>
@stop
@section('ownJs')
    <script>
        $('.modify_apply').click(function(){
            var id = $(this).data('id') ;
            location.href = '/dashboard/user/'+id;
        });
        $('#to_be_open').click(function(){
            $('#status_open').val('0');
            $('#search_form').submit();
        });
        $('#opened').click(function(){
            $('#status_open').val('1');
            $('#search_form').submit();
        });
        $('#unexpire').click(function(){
            $('#status_type').val('1');
            $('#search_form').submit();
        });
        $('#expire').click(function(){
            $('#status_type').val('2');
            $('#search_form').submit();
        });
    </script>
@stop